summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-09-18 00:23:40 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-09-18 00:23:40 +0000
commitcf8dac0c6490469dab88a560004b0c07dbd48612 (patch)
treeb9e76061e80d868331e6b4277deecb9086f845f3 /app/[lng]/evcp/(evcp)
parente5745fc0268bbb5770bc14a55fd58a0ec30b466e (diff)
(대표님) rfq, 계약, 서명 등
Diffstat (limited to 'app/[lng]/evcp/(evcp)')
-rw-r--r--app/[lng]/evcp/(evcp)/buyer-signature/page.tsx24
-rw-r--r--app/[lng]/evcp/(evcp)/general-contracts/page.tsx39
-rw-r--r--app/[lng]/evcp/(evcp)/itb-create/page.tsx164
3 files changed, 193 insertions, 34 deletions
diff --git a/app/[lng]/evcp/(evcp)/buyer-signature/page.tsx b/app/[lng]/evcp/(evcp)/buyer-signature/page.tsx
new file mode 100644
index 00000000..fa3a1953
--- /dev/null
+++ b/app/[lng]/evcp/(evcp)/buyer-signature/page.tsx
@@ -0,0 +1,24 @@
+import { BuyerSignatureUploadForm } from '@/lib/shi-signature/upload-form';
+import { SignatureList } from '@/lib/shi-signature/signature-list';
+import { getAllSignatures } from '@/lib/shi-signature/buyer-signature';
+
+export default async function BuyerSignaturePage() {
+ const signatures = await getAllSignatures();
+
+ return (
+ <div className="container mx-auto py-8 max-w-4xl">
+ <div className="space-y-8">
+ <div>
+ <h1 className="text-3xl font-bold">구매자 서명 관리</h1>
+ <p className="text-muted-foreground mt-2">
+ 계약서에 자동으로 적용될 삼성중공업 서명을 관리합니다.
+ </p>
+ </div>
+
+ <BuyerSignatureUploadForm />
+
+ <SignatureList signatures={signatures} />
+ </div>
+ </div>
+ );
+} \ No newline at end of file
diff --git a/app/[lng]/evcp/(evcp)/general-contracts/page.tsx b/app/[lng]/evcp/(evcp)/general-contracts/page.tsx
index 47677bb3..a6d5057c 100644
--- a/app/[lng]/evcp/(evcp)/general-contracts/page.tsx
+++ b/app/[lng]/evcp/(evcp)/general-contracts/page.tsx
@@ -7,6 +7,7 @@ import {
getGeneralContractCategoryCounts,
getVendors
} from "@/lib/general-contracts/service"
+import { searchParamsCache } from "@/lib/general-contracts/validation"
import { GeneralContractsTable } from "@/lib/general-contracts/main/general-contracts-table"
import { getValidFilters } from "@/lib/data-table"
import { type SearchParams } from "@/types/table"
@@ -21,43 +22,13 @@ interface IndexPageProps {
searchParams: Promise<SearchParams>
}
-// searchParams 파싱을 위한 기본 파서 함수
-function parseSearchParams(searchParams: SearchParams) {
- const page = Number(searchParams.page) || 1
- const perPage = Number(searchParams.per_page) || 10
- const sort = searchParams.sort
- ? Array.isArray(searchParams.sort)
- ? searchParams.sort.map((s: string) => {
- const [id, desc] = s.split('.')
- return { id, desc: desc === 'desc' }
- })
- : [{ id: searchParams.sort.split('.')[0], desc: searchParams.sort.split('.')[1] === 'desc' }]
- : [{ id: "registeredAt", desc: true }]
-
- return {
- page,
- perPage,
- sort,
- filters: [],
- contractNumber: searchParams.contractNumber as string,
- name: searchParams.name as string,
- status: searchParams.status as string,
- category: searchParams.category as string,
- type: searchParams.type as string,
- vendorId: searchParams.vendorId ? Number(searchParams.vendorId) : undefined,
- createdAtFrom: searchParams.createdAtFrom as string,
- createdAtTo: searchParams.createdAtTo as string,
- signedAtFrom: searchParams.signedAtFrom as string,
- signedAtTo: searchParams.signedAtTo as string,
- search: searchParams.search as string,
- }
-}
-
export default async function GeneralContractsPage(props: IndexPageProps) {
// ✅ searchParams 파싱
const searchParams = await props.searchParams
- const search = parseSearchParams(searchParams)
-
+ const search = searchParamsCache.parse(searchParams)
+
+ console.log("Parsed search params:", search)
+
const validFilters = getValidFilters(search.filters)
// ✅ 모든 데이터를 병렬로 로드
diff --git a/app/[lng]/evcp/(evcp)/itb-create/page.tsx b/app/[lng]/evcp/(evcp)/itb-create/page.tsx
new file mode 100644
index 00000000..54040e7f
--- /dev/null
+++ b/app/[lng]/evcp/(evcp)/itb-create/page.tsx
@@ -0,0 +1,164 @@
+// app/[lng]/purchase-requests/page.tsx
+
+import * as React from "react";
+import { type SearchParams } from "@/types/table";
+import { getValidFilters } from "@/lib/data-table";
+import { Shell } from "@/components/shell";
+import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton";
+import { Button } from "@/components/ui/button";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { Plus, FileText, Clock, CheckCircle, XCircle, Send } from "lucide-react";
+import Link from "next/link";
+import { searchParamsPurchaseRequestCache } from "@/lib/itb/validations";
+import { getAllPurchaseRequests, getPurchaseRequestStats } from "@/lib/itb/service";
+import { PurchaseRequestsTable } from "@/lib/itb/table/purchase-requests-table";
+
+interface PurchaseRequestsPageProps {
+ params: {
+ lng: string;
+ };
+ searchParams: Promise<SearchParams>;
+}
+
+export default async function PurchaseRequestsPage(props: PurchaseRequestsPageProps) {
+ const resolvedParams = await props.params;
+ const lng = resolvedParams.lng;
+
+ const searchParams = await props.searchParams;
+
+ // Parse search params
+ const search = searchParamsPurchaseRequestCache.parse(searchParams);
+ const validFilters = getValidFilters(search.filters);
+
+ // Load data
+ const promises = Promise.all([
+ getAllPurchaseRequests({
+ ...search,
+ filters: validFilters,
+ }),
+ getPurchaseRequestStats(),
+ ]);
+
+ return (
+ <Shell className="gap-4">
+ <div className="flex items-center justify-between">
+ <div>
+ <h2 className="text-2xl font-bold tracking-tight">
+ 구매 요청 관리
+ </h2>
+ <p className="text-muted-foreground">
+ 프로젝트별 자재 구매 요청을 생성하고 관리합니다.
+ </p>
+ </div>
+ </div>
+
+ {/* 통계 카드 */}
+ <React.Suspense
+ fallback={
+ <div className="grid gap-4 md:grid-cols-2 lg:grid-cols-6">
+ {[...Array(6)].map((_, i) => (
+ <Card key={i}>
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
+ <CardTitle className="text-sm font-medium">
+ <div className="h-4 w-20 bg-muted animate-pulse rounded" />
+ </CardTitle>
+ </CardHeader>
+ <CardContent>
+ <div className="h-8 w-12 bg-muted animate-pulse rounded" />
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ }
+ >
+ <PurchaseRequestStats promises={promises} />
+ </React.Suspense>
+
+ <React.Suspense
+ fallback={
+ <DataTableSkeleton
+ columnCount={13}
+ searchableColumnCount={1}
+ filterableColumnCount={3}
+ cellWidths={[
+ "8rem", // requestCode
+ "15rem", // requestTitle
+ "12rem", // projectCode
+ "15rem", // projectName
+ "10rem", // packageNo
+ "8rem", // status
+ "10rem", // engPicName
+ "10rem", // purchasePicName
+ "10rem", // estimatedBudget
+ "10rem", // requestedDeliveryDate
+ "8rem", // itemCount
+ "10rem", // createdAt
+ "8rem", // actions
+ ]}
+ shrinkZero
+ />
+ }
+ >
+ <PurchaseRequestsTable promises={promises} />
+ </React.Suspense>
+ </Shell>
+ );
+}
+
+// 통계 컴포넌트
+async function PurchaseRequestStats({
+ promises
+}: {
+ promises: Promise<[any, any]>
+}) {
+ const [, stats] = await promises;
+
+ const statCards = [
+ {
+ title: "전체",
+ value: stats?.total || 0,
+ icon: FileText,
+ color: "text-blue-500",
+ },
+ {
+ title: "작성중",
+ value: stats?.draft || 0,
+ icon: Clock,
+ color: "text-gray-500",
+ },
+
+ {
+ title: "RFQ 생성",
+ value: stats?.rfqCreated || 0,
+ icon: Send,
+ color: "text-red-500",
+ },
+ ];
+
+ return (
+ <div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
+ {statCards.map((card, index) => {
+ const Icon = card.icon;
+ return (
+ <Card key={index}>
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
+ <CardTitle className="text-sm font-medium">
+ {card.title}
+ </CardTitle>
+ <Icon className={`h-4 w-4 ${card.color}`} />
+ </CardHeader>
+ <CardContent>
+ <div className="text-2xl font-bold">{card.value}</div>
+ </CardContent>
+ </Card>
+ );
+ })}
+ </div>
+ );
+}
+
+// Metadata
+export const metadata = {
+ title: "Purchase Request Management",
+ description: "Create and manage material purchase requests for projects",
+}; \ No newline at end of file